package com.bloveoacom.weight;

import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bloveoacom.util.GlideUtil;
import com.bloveoacom.util.StringUtils;
import com.bloveoacom.weichi.R;
import com.bloveoacom.weichi.bean.ActivityDetailBean;


public class ActorInfoDialog extends Dialog implements View.OnClickListener {
    private TextView tvContent;
    private ImageView ivHeader;
    private TextView tvName;
    private ImageView ivClose;
    private ActivityDetailBean.StarListBean starListBean;

    public ActorInfoDialog(Context context, ActivityDetailBean.StarListBean starListBean, int theme) {
        super(context, theme);
        this.starListBean=starListBean;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.dialog_actor_info);
        //设置window背景，默认的背景会有Padding值，不能全屏。当然不一定要是透明，你可以设置其他背景，替换默认的背景即可。
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //一定要在setContentView之后调用，否则无效
        getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        this.setCanceledOnTouchOutside(true);
        tvContent = (TextView) findViewById(R.id.tv_content);
        ivHeader = (ImageView) findViewById(R.id.iv_header);
        tvName = (TextView) findViewById(R.id.tv_name);
        ivClose = (ImageView) findViewById(R.id.iv_close);
        //设置监听
        ivClose.setOnClickListener(this);

        if(null!=starListBean){
            GlideUtil.loadCircleImage(ivHeader, StringUtils.getFullUrl(starListBean.getStarImg(), 0));
            tvContent.setText(starListBean.getStatTxt());
            tvName.setText(starListBean.getStatName());
        }

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_close:
                dismiss();
                break;
            default:
                break;
        }
    }


}
